#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;

int main() {
    string filename = "../oj_server/conf/service_machine.conf";

    // 打开文件
    ifstream file(filename);
    if (!file.is_open()) 
    {
        cerr << "无法打开文件: " << filename << endl;
        return 1;
    }

    string line;
    while (getline(file, line)) // 逐行读取文件
    {   
        stringstream ss(line);
        string ip, port;
        if (getline(ss, ip, ':') && getline(ss, port)) 
        { // 按冒号分割
            cout << ip << " " << port << endl;
        } 
        else 
        {
            cerr << "错误的格式: " << line << endl;
        }
    }

    file.close(); // 关闭文件
    return 0;
}
